<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>直接购买添加地址</title>
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript">
		function my(){
			var msg = '${MSG}';
			if(msg!=""){
				alert(msg);
			}
		}
	</script>
	
	<script type="text/javascript">
		function checkLogin(){
			var name = document.getElementsByName("name")[0].value;
			var phone = document.getElementsByName("phone")[0].value;
			var addr = document.getElementsByName("addr")[0].value;
			if(name=="" || name==null){
				alert("收货人姓名不能为空");
				return false;
			}else if(phone=="" || phone==null){
				alert("收货人电话不能为空");
				return false;
			}else if(addr=="" || addr==null){
				alert("详细地址不能为空");
				return false;
			}
			return true;
		}
	</script>
	<script language="javascript"> 
		function changeProvince() {
			var slecctS = document.querySelectorAll(".select");
			var countrys = new Array();
			countrys["0"] = ["--请选择所在市--"];
			countrys["北京"] = ["北京市"];
			countrys["上海"] = ["上海市"];
			countrys["广州省"] = ["广州市", "珠海市", "汕头市"];
			countrys["深圳"] = ["深圳市"];
			countrys["重庆"] = ["重庆市"];
			countrys["天津"] = ["天津市"];
			var value = slecctS[0].value;
			//option 集合可返回包含 <select> 元素中所有 <option> 的一个数组。
			//注意： 数组中的每个元素对应一个 <option> 标签 - 由 0 起始。 
			slecctS[1].options.length = 0;
			var option;
			for(i = 0; i < countrys[value].length; i++) {
				//new Option("文本","值",true,true)
				//后面两个true分别表示默认被选中和有效!
				option = new Option(countrys[value][i], countrys[value][i]);
				slecctS[1].options.add(option);
				slecctS[1].options.selected=countrys[value][0];
			}
			if(slecctS[0].value == "0"){
				slecctS[1].disabled = true;
				slecctS[2].disabled = true;
			}else{
				slecctS[1].disabled = false;
			} 
			changeCity();
		}
		function changeCity() {
			var slecctS = document.querySelectorAll(".select");
			var citys = new Array();
			citys["0"] = ["--请选择所在区--"];
			citys["北京市"] = ["朝阳区", "东城区", "西城区", "海淀区", "宣武区", "丰台区"];
			citys["上海市"] = ["宝山区", "长宁区", "闵行区", "杨浦区","黄浦区","虹口区","静安区"];
			citys["广州市"] = ["荔湾区","越秀区","海珠区","天河区","白云区","黄埔区","番禺区","花都区","萝岗区","南沙区","增城区","从化区"];
			citys["珠海市"] = ["香洲区","金湾区","斗门区"];
			citys["汕头市"] = ["金平区","龙湖区","潮阳区","潮南区","濠江区","澄海区","南澳县"];
			citys["深圳市"] = ["福田区", "南山区", "宝安区", "龙岗区", "盐田区", "罗湖区"];
			citys["重庆市"] = ["万州区", "渝中区", "大渡口区", "江北区", "沙坪坝区", "渝北区"];
			citys["天津市"] = ["和平区", "河东区", "河西区", "南开区", "红桥区", "武清区"];
			var value = slecctS[1].value;
			//option 集合可返回包含 <select> 元素中所有 <option> 的一个数组。
			//注意： 数组中的每个元素对应一个 <option> 标签 - 由 0 起始。 
			slecctS[2].options.length = 0;
			var option;
			for(i = 0; i < citys[value].length; i++) {
				//new Option("文本","值",true,true)
				//后面两个true分别表示默认被选中和有效!
				option = new Option(citys[value][i], citys[value][i]);
				slecctS[2].options.add(option);
				slecctS[2].options.selected=citys[value][0];
			}
			if(slecctS[1].value == "0"){
				slecctS[2].disabled = true;
			}else{
				slecctS[2].disabled = false;
			} 
		}
	</script>
</head>
  </head>
  
  <body onclick="my()">
<div class="page-container">
<div >添加地址:</div>
	<form class="form form-horizontal" id="form-article-add"action="<%=basePath%>/address/addBuyer_addr.do?shop_id=${shop_id}&gnumber=${gnumber}" method="post" onsubmit="return checkLogin()">
		<input type="hidden" name="id" value="${id}">
  	 	<input type="hidden" name="uid" value="<%=uid%>">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>收件人姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value=""  name="name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>所在省份：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select name="province" onChange="changeProvince()" class="select">
					<option value="0">--请选择省/城市--</option>
					<option value="北京">北京</option>
					<option value="上海">上海</option>
					<option value="广州省">广州省</option>
					<option value="深圳">深圳</option>
					<option value="重庆">重庆</option>
					<option value="天津">天津</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">所在市：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select name="city" class="select" onChange="changeCity()" >
					<option value="0">--请选择所在市--</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">所在区：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select name="district" class="select" >
					<option value="0">--请选择所在区--</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>详细地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" name="addr">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>联系电话：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" name="phone">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">邮政编码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="postcode">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type="submit" class="btn btn-primary radius" type="button" value="保存并提交审核">
			</div>
		</div>
	</form>
</div>


<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript" src="../lib/webuploader/0.1.5/webuploader.min.js"></script> 
</body>
</html>
